//
//  ATOneViewController.m
//  TAUi
//
//  Created by Lin Buken on 16/1/11.
//  Copyright © 2016年 com.aiton. All rights reserved.
//

#import "ATOneViewController.h"

@interface ATOneViewController ()

@end

@implementation ATOneViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn1.frame = CGRectMake(20, 460, 36, 36);
    
//    //    普通状态
//    [btn1 setTitle:@"Normal" forState:UIControlStateNormal];
//    //选择状态
//    [btn1 setTitle:@"Selected" forState:UIControlStateSelected];
    
    [btn1 setImage:[UIImage imageNamed:@"address_unchecked_ico"] forState:UIControlStateNormal];
    [btn1 setImage:[UIImage imageNamed:@"address_checked_ico"] forState:UIControlStateSelected];

//    //    设置按钮文字的字体
//    btn1.titleLabel.font = [UIFont systemFontOfSize:24.0];
    
    //    添加点击事件
    [btn1 addTarget:self action:@selector(touchAction:) forControlEvents:UIControlEventTouchUpInside];
    [btn1 addTarget:self action:@selector(downAction) forControlEvents:UIControlEventTouchDown];
    [btn1 addTarget:self action:@selector(dragInside) forControlEvents:UIControlEventTouchDragInside];

    UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn2.frame = CGRectMake(20, 500, 36, 36);
    
    [btn2 setImage:[UIImage imageNamed:@"address_unchecked_ico"] forState:UIControlStateNormal];
    [btn2 setImage:[UIImage imageNamed:@"address_checked_ico"] forState:UIControlStateSelected];
    
    //    添加点击事件
    [btn2 addTarget:self action:@selector(touchAction:) forControlEvents:UIControlEventTouchUpInside];
    [btn2 addTarget:self action:@selector(downAction) forControlEvents:UIControlEventTouchDown];
    [btn2 addTarget:self action:@selector(dragInside) forControlEvents:UIControlEventTouchDragInside];
    
    [self.view addSubview:btn1];
    [self.view addSubview:btn2];
}

- (void)touchAction:(UIButton *)sender
{
    NSLog(@"TouchUpInside");
    if (sender.selected == NO) {
        sender.selected = YES;
    }else
    {
        sender.selected = NO;
    }
    
}
- (void)downAction
{
    NSLog(@"downAction");
}
- (void)dragInside
{
    NSLog(@"dragInside");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
